<template>
  <div style="height: 100%; width: 100%; position: relative" ref="xTableDiv">
      <div class="pagetop">
          <div style="width: 70%; height: 100%; border: 1px solid #ccc; border-right: none">
              <div style="width: 400px; height: 47%; float: left">
                  <table table1style style="width: 100%; font-size: 12px">
                      <tr>
                          <td colspan="8" style="padding-left: 20px">
                              <font color="#409EFF">合并前</font>
                          </td>
                      </tr>
                      <tr>
                          <td align="right">报告单元</td>
                          <td>
                              <rm-ddl-rptunit prgno="LIS322" v-model="txtrptunit1" filterable defaultflag="1" :clearable="false" @change="handlerrptitemchange($event)" :appendtobody="true" visible-change:true @keyup.enter.native="inputautofocus($event, 'popinput1')" width="215px" ref="popinput1"></rm-ddl-rptunit>
                          </td>
                      </tr>
                      <tr>
                          <td align="right">标本日期</td>
                          <td>
                              <el-date-picker v-model="sampledatetime1" type="date" placeholder="选择日期" style="width: 215px" value-format="yyyy-MM-dd"> </el-date-picker>
                          </td>
                      </tr>
                      <tr>
                          <td align="right">样本号</td>
                          <td>
                              <el-input v-model="sampleno1" placeholder="请输入样本号" style="width: 215px" @keyup.enter.native="InitPageDate, inputautofocus($event, 'popinput3')" ref="popinput3"></el-input>
                          </td>
                      </tr>
                  </table>
              </div>
              <div style="width: calc(100% - 400px); height: 47%; float: left">
                  <table table1style style="width: 100%; font-size: 12px">
                      <tr>
                          <td colspan="8">
                              <font color="#409EFF">合并内容</font>
                          </td>
                      </tr>
                      <tr>
                          <td>
                              <el-checkbox v-model="patzl" @change="patzlChange($event)">病人资料</el-checkbox>
                          </td>
                          <td>
                              <el-checkbox v-model="chkry" @change="chkryChange($event)">检验人员</el-checkbox>
                          </td>
                          <td>
                              <el-checkbox v-model="reqxx" @change="reqxxChange($event)">申请信息</el-checkbox>
                          </td>
                      </tr>
                      <tr>
                          <td>
                              <el-checkbox v-model="allxm" @change="allxmChange($event)">所有项目</el-checkbox>
                          </td>
                          <td>
                              <el-checkbox v-model="chartxx" @change="chartxxChange($event)">图形信息</el-checkbox>
                          </td>
                          <td>
                              <el-checkbox v-model="specimenlx" @change="specimenlxChange($event)">标本类型</el-checkbox>
                          </td>
                      </tr>
                      <tr>
                          <td>
                              <el-checkbox v-model="sanglexm" @change="sanglexmChange($event)">单个项目</el-checkbox>
                          </td>
                          <td colspan="5">
                              <div v-if="singleitemshow">
                                  <el-select v-model="singleItem" style="width: 100%" @dblclick.native="dialogRptVisible = true" @change="SingleChange" placeholder="双击可多选" clearable>
                                      <el-option v-for="(item, index) in singleItemOption" :value="item.rpt_itemcode" :key="index" :label="item.rpt_itemname"></el-option>
                                  </el-select>
                              </div>
                          </td>
                      </tr>
                      <tr>
                          <td>
                              <el-checkbox v-model="groupxm" @change="groupxmChange($event)">组合项目</el-checkbox>
                          </td>
                          <td colspan="5">
                              <div v-if="groupitemshow">
                                  <el-popover placement="bottom" width="1000" trigger="click" v-model="visible">
                                      <el-table :data="groupItemOption" height="400" @row-click="handleRowChange">
                                          <el-table-column width="150" property="itemcombname" label="项目组合名称"></el-table-column>
                                          <el-table-column width="100" property="detail_count" label="子项个数"></el-table-column>
                                          <el-table-column width="350" property="description" label="描述"></el-table-column>
                                          <el-table-column width="150" property="inputcode" label="输入码"></el-table-column>
                                          <el-table-column width="100" property="itemcombid" label="项目组合ID"></el-table-column>
                                          <el-table-column width="100" property="itemcombkind" label="组合类别"></el-table-column>
                                      </el-table>
                                      <el-input v-model="groupItem" slot="reference"></el-input>
                                  </el-popover>
                              </div>
                          </td>
                      </tr>
                  </table>
              </div>
              <div style="width: 400px; height: 52%; float: left">
                  <table table1style style="width: 100%; font-size: 12px">
                      <tr>
                          <td colspan="8" style="padding-left: 20px">
                              <font color="#409EFF">合并后</font>
                          </td>
                      </tr>
                      <tr>
                          <td align="right">报告单元</td>
                          <td>
                              <rm-ddl-rptunit prgno="LIS322" v-model="txtrptunit2" filterable :clearable="false" defaultflag="1" :appendtobody="true" @keyup.enter.native="inputautofocus($event, 'txtrptunit2')" width="215px" ref="txtrptunit2"></rm-ddl-rptunit>
                          </td>
                      </tr>
                      <tr>
                          <td align="right">标本日期</td>
                          <td>
                              <el-date-picker v-model="sampledatetime2" type="date" placeholder="选择日期" :style="{ width: areatimeflag == '1' ? '105px' : '215px' }" value-format="yyyy-MM-dd" class="datelist"> </el-date-picker>
                              <span v-show="areatimeflag == '1'">-</span>
                              <el-date-picker v-show="areatimeflag == '1'" v-model="sampledatetime22" type="date" placeholder="选择日期" style="width: 105px" value-format="yyyy-MM-dd" class="datelist"> </el-date-picker>
                          </td>
                      </tr>
                      <tr>
                          <td align="right">样本号</td>
                          <td>
                              <el-input v-model="sampleno2" placeholder="请输入样本号" style="width: 215px" @keyup.enter.native="InitPageDate, inputautofocus($event, 'popinput3')" id="mergeaftersamplenoid" @input="sampleno2input" ref="popinput3" :readonly="AccordingBarcodeZNHB ? true : false"></el-input>
                          </td>
                      </tr>
                      <tr>
                          <td colspan="2" style="padding-left: 30px">
                              <el-checkbox v-model="AccordingBarcodeZNHB">根据条码号智能合并</el-checkbox>
                              <el-checkbox v-model="areatimeflag" false-label="0" true-label="1">复制到多天</el-checkbox>
                          </td>
                      </tr>
                  </table>
              </div>
              <div style="width: calc(100% - 400px); height: 52%; float: left">
                  <table style="width: 100%; font-size: 12px">
                      <tr>
                          <td colspan="2">
                              <font color="#409EFF">合并方式</font>
                          </td>
                      </tr>
                      <tr>
                          <td>
                              <el-radio v-model="copymove" label="1">复制</el-radio>
                          </td>
                          <td>
                              <el-radio v-model="covercancel" label="2">如果存在就覆盖</el-radio>
                          </td>
                      </tr>
                      <tr>
                          <td>
                              <el-radio v-model="copymove" label="3">移动</el-radio>
                          </td>
                          <td>
                              <el-radio v-model="covercancel" label="4">如果存在就取消</el-radio>
                          </td>
                      </tr>
                      <tr>
                          <td colspan="2">
                              <el-checkbox v-model="skipmerge" @change="skipmergeChange($event)">合并前结果不包含所选项目则跳过合并</el-checkbox>
                          </td>
                      </tr>
                  </table>
              </div>
          </div>
          <div style="width: 30%; border: 1px solid #ccc; height: 100%; border-left: none">
              <div style="width: 100%; float: left; height: 75%; padding: 10px; font-family: verdana; font-size: 12px; color: black" v-html="defineshow"></div>
              <div style="width: 100%; float: left; height: 25%; text-align: center">
                  <el-button icon="el-icon-search" @click="GetMergeData()">查 询</el-button>
                  <el-button icon="el-icon-set-up" @click="btnMerge()">合 并</el-button>
              </div>
          </div>
      </div>
      <div class="pagecenter">
          <div class="middle-center">
              <div style="width: 720px; padding-right: 5px; height: 100%; float: left">
                  <vxe-table show-overflow ref="sourcetable" :data.sync="SourceData" :cell-class-name="ListClassName" height="auto" :sort-config="{ trigger: 'cell' }" border size="mini" show-header-overflow highlight-current-row resizable header-align="center">
                      <vxe-table-column align="center" type="index" width="40" title="No."></vxe-table-column>
                      <vxe-table-column field="rechkflag1" title="审" width="30" align="center">
                          <template v-slot="{ row }">
                              <div v-if="row.rechkflag1 == '9'"><span v-bind:style="{ color: 'black' }">审</span></div>
                              <div v-else-if="row.rechkflag1 == '1'"><span v-bind:style="{ color: 'black' }">签</span></div>
                              <div v-else-if="row.prechkflag1 == '1'"><span v-bind:style="{ color: 'black' }">待</span></div>
                              <div v-else></div>
                          </template>
                      </vxe-table-column>
                      <vxe-table-column field="sampleno1" title="标本号" width="40" align="center"></vxe-table-column>
                      <vxe-table-column field="barcode1" title="条码号" width="120"></vxe-table-column>
                      <vxe-table-column field="pat_name1" title="姓名" width="80" align="center"></vxe-table-column>
                      <vxe-table-column field="pat_sexname1" title="性别" width="40" align="center"></vxe-table-column>
                      <vxe-table-column field="spacesplit" title="" width="40" align="center"></vxe-table-column>
                      <vxe-table-column field="rechkflag2" title="审" width="30" align="center">
                          <template v-slot="{ row }">
                              <div v-if="row.rechkflag2 == '9'"><span v-bind:style="{ color: 'black' }">审</span></div>
                              <div v-else-if="row.rechkflag2 == '1'"><span v-bind:style="{ color: 'black' }">签</span></div>
                              <div v-else-if="row.prechkflag2 == '1'"><span v-bind:style="{ color: 'black' }">待</span></div>
                              <div v-else></div>
                          </template>
                      </vxe-table-column>
                      <vxe-table-column field="sampleno2" title="标本号" width="40" align="center"></vxe-table-column>
                      <vxe-table-column field="barcode2" title="条码号" width="120"></vxe-table-column>
                      <vxe-table-column field="pat_name2" title="姓名" width="80" align="center"></vxe-table-column>
                      <vxe-table-column field="pat_sexname2" title="性别" width="40" align="center"></vxe-table-column>
                  </vxe-table>
              </div>
              <!-- <div style="width:360px;padding-right: 5px;height:100%;float:left">
                  <vxe-table show-overflow ref="resulttable" :data.sync="PurposeData" :row-class-name="ListClassName" height="auto" :sort-config="{trigger: 'cell'}" border size="mini" show-header-overflow highlight-current-row resizable header-align="center">
                      <vxe-table-column align="center" type="index" width="40" title="No."></vxe-table-column>
                      
                  </vxe-table>
              </div> -->
              <div style="overflow: hidden; width: calc(100% - 730px); float: left">
                  <el-input type="textarea" v-model="mergemessages" :rows="textheight" style="height: 100%"></el-input>
              </div>
          </div>
      </div>

      <!--多选弹窗--->
      <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :visible.sync="dialogRptVisible" :destroy-on-close="true" title="报告项目" v-if="dialogRptVisible">
          <rm-chkboxSelect2 @cancel="dialogRptVisible = false" :isAllRpt="1" :rptunitid="txtrptunit1" :rptunitdisabled="true" @selitems="SelectRptItems" ref="rptdialog"></rm-chkboxSelect2>
      </el-dialog>
  </div>
</template>

<script type="text/javascript">
export default {
  props: { beforerptunitid: { type: Number } },
  watch: {
      beforerptunitid(newval) {
          this.txtrptunit1 = newval;
          this.txtrptunit2 = newval;
      },
  },
  name: "LIS322",
  data() {
      return {
          txtrptunit1: "",
          txtrptunit2: "",
          sampledatetime1: this.$pub.InitDate(),
          sampledatetime2: this.$pub.InitDate(),
          sampledatetime22: this.$pub.InitDate(),
          areatimeflag: "0", //复制到多天
          sampleno1: "",
          sampleno2: "",
          samplenolist1: [],
          samplenolist2: [],
          samplenolength: 0,
          groupxm: false,
          sanglexm: false,
          specimenlx: false,
          chartxx: false,
          allxm: false,
          reqxx: false,
          chkry: false,
          patzl: false,
          skipmerge: false,
          singleItem: "",
          singleitemmulti: "",
          groupItem: "",
          groupItemcopy: "",
          groupItemOption: [],
          groupitemshow: false,
          singleItemOption: [],
          singleitemshow: false,
          copymove: "1",
          covercancel: "4",
          AccordingBarcodeZNHB: false,
          visible: false,
          mergemessages: "",
          defineshow: "说明：标本号可以输入如：1,2,5-8等格式来表示多个标本，在同时合并多个标本的情况下，要确保合并前的标本个数和合并后的标本个数相等，否则系统无法一一对照进行合并；只有一种特殊情况下可以进行一对多合并；那就是将上一个标本复制到多个标本上。 复制到多天自动合并标本到选定时间区间标本号，最多自动合并30天",
          dialogRptVisible: false, //报告项目多选弹窗
          textheight: 20,
          SourceData: [], //合并前样本
          PurposeData: [], //合并后样本
      };
  },
  created() {
      this.InitPageDate(); //初始化主列表
      this.getinitList(this.txtrptunit1); //初始化下拉框的数据
  },
  mounted() {
      this.textheight = (this.$refs.xTableDiv.offsetHeight - 260) / 18;
  },
  updated() {},
  methods: {
      InitPageDate() {
          if (this.beforerptunitid) {
              this.txtrptunit1 = this.beforerptunitid;
              this.txtrptunit2 = this.beforerptunitid;
          }
      },
      btnMerge() {
          this.$tool
              .request({
                  url: "LIS/LIS3/LIS322",
                  method: "post",
                  data: {
                      action: "canmerge",
                      rptunitid1: this.txtrptunit1, //合并前报告ID
                      sampledatetime1: this.sampledatetime1, //合并前报告日期
                      sampleno1: this.sampleno1, //合并前标本号
                      rptunitid2: this.txtrptunit2, //合并前报告ID
                      sampledatetime2: this.sampledatetime2, //合并前报告日期
                      sampleno2: this.sampleno2, //合并后标本号
                  },
              })
              .then((res) => {
                  if (res.errcode == 1) {
                      this.samplenolist1 = res.id1;
                      this.samplenolist2 = res.id2;
                      this.samplenolength = 0;
                      this.MergeAction(this.samplenolist1[0], this.samplenolist2[0], this.sampledatetime2);
                  } else {
                      if (res.hasOwnProperty("errmsg")) res.msg = res.errmsg;
                      this.$alert(res.msg, "错误");
                  }
              })
              .catch((e) => {
                  console.log("error", e);
              });
      },
      //对于每一条标本的合并
      MergeAction(sampleno1, sampleno2, aftersampletime) {
          this.$tool
              .request({
                  url: "LIS/LIS3/LIS322",
                  method: "post",
                  data: {
                      action: "mergeaction",
                      rptunitid1: this.txtrptunit1, //合并前报告ID
                      sampledatetime1: this.sampledatetime1, //合并前报告日期
                      sampleno1: sampleno1, //合并前标本号
                      rptunitid2: this.txtrptunit2, //合并后报告ID
                      sampledatetime2: aftersampletime, //合并后报告日期
                      sampleno2: sampleno2, //合并后标本号
                      groupxm: this.groupxm ? "1" : "0", //是否合并组合项目
                      sanglexm: this.sanglexm ? "1" : "0", //是否仅合并单项目结果
                      specimenlx: this.specimenlx ? "1" : "0", //是否合并标本类型
                      chartxx: this.chartxx ? "1" : "0", //是否合并图形信息
                      allxm: this.allxm ? "1" : "0", //是否合并为所有报告项目结果
                      reqxx: this.reqxx ? "1" : "0", //是否合并申请信息
                      chkry: this.chkry ? "1" : "0", //是否合并检验信息
                      patzl: this.patzl ? "1" : "0", //是否合并病人信息
                      singleItem: this.singleitemmulti ? this.singleitemmulti : this.singleItem, //单项目时的报告项目代码
                      groupItemcopy: this.groupItemcopy, //组合项目时的组合代码
                      copymove: this.copymove, //1复制，3移动
                      covercancel: this.covercancel, //2存在就覆盖，4存在就取消
                      AccordingBarcodeZNHB: this.AccordingBarcodeZNHB, //是否根据条码号智能合并
                      areatimeflag: this.areatimeflag, //复制到多天
                      sampledatetime22: this.sampledatetime22, //复制到多天结束时间
                      skipmerge: this.skipmerge ? "1" : "0", //合并前结果不包含所选项目则跳过合并
                  },
              })
              .then((res) => {
                  //   this.msgList = res.listMsg;
                  //errcode = 2 复制到多天,errcode = 复制到单天
                  if (res.errcode == "2") {
                      var message = "【" + res.rptunitname + "】 " + res.nowtime + " 标本号【" + sampleno2 + "】合并成功";
                      this.mergemessages += message + "\n";
                      this.samplenolength += 1;
                      if (this.samplenolength < this.samplenolist2.length) {
                          this.MergeAction(this.samplenolist1[this.samplenolength], this.samplenolist2[this.samplenolength], res.nowtime);
                      } else if (res.nexttime != "") {
                          this.samplenolength = 0;
                          this.MergeAction(this.samplenolist1[this.samplenolength], this.samplenolist2[this.samplenolength], res.nexttime);
                      }
                  } else if (res.errcode == "1") {
                      var message = "【" + res.rptunitname + "】 " + this.sampledatetime2 + " 标本号【" + sampleno2 + "】合并成功";
                      this.mergemessages += message + "\n";
                      this.samplenolength += 1;
                      if (this.samplenolength < this.samplenolist2.length) {
                          if (this.samplenolist1.length == 1) {
                              this.MergeAction(this.samplenolist1[0], this.samplenolist2[this.samplenolength], this.sampledatetime2);
                          } else {
                              this.MergeAction(this.samplenolist1[this.samplenolength], this.samplenolist2[this.samplenolength], this.sampledatetime2);
                          }
                      } else {
                          this.samplenolength = 0;
                          this.samplenolist1 = [];
                          this.samplenolist2 = [];
                      }
                  } else {
                      if (res.hasOwnProperty("errmsg")) res.msg = res.errmsg;
                      this.mergemessages += res.msg + "\n";

                      this.samplenolength += 1;
                      if (res.hasOwnProperty("nexttime")) {
                          if (this.samplenolength < this.samplenolist2.length) this.MergeAction(this.samplenolist1[this.samplenolength], this.samplenolist2[this.samplenolength], res.nowtime);
                          else if (res.nexttime != "") this.MergeAction(this.samplenolist1[this.samplenolength], this.samplenolist2[this.samplenolength], res.nexttime);
                      } else {
                          if (this.samplenolength < this.samplenolist2.length) {
                              if (this.samplenolist1.length == 1) {
                                  this.MergeAction(this.samplenolist1[0], this.samplenolist2[this.samplenolength], this.sampledatetime2);
                              } else {
                                  this.MergeAction(this.samplenolist1[this.samplenolength], this.samplenolist2[this.samplenolength], this.sampledatetime2);
                              }
                          } else {
                              this.samplenolength = 0;
                              this.samplenolist1 = [];
                              this.samplenolist2 = [];
                          }
                      }
                  }
              })
              .catch((e) => {
                  console.log("error", e);
              });
      },
      handleRowChange(row) {
          this.groupItem = row.itemcombname;
          this.groupItemcopy = row.itemcombid;
          this.visible = false;
      },
      getinitList(val) {
          this.$tool
              .request({
                  url: "LIS/LIS3/LIS322",
                  method: "post",
                  data: {
                      action: "getinitList",
                      rptunitid: val,
                  },
              })
              .then((res) => {
                  this.singleItemOption = res.singleItemOption;
                  this.groupItemOption = res.groupItemOption;
              })
              .catch((e) => {
                  console.log("error", e);
              });
      },
      GetMergeData() {
          this.$tool
              .request({
                  url: "LIS/LIS3/LIS322",
                  method: "post",
                  data: {
                      action: "getmergedata",
                      rptunitid1: this.txtrptunit1, //合并前报告ID
                      sampledatetime1: this.sampledatetime1, //合并前报告日期
                      sampleno1: this.sampleno1, //合并前标本号
                      rptunitid2: this.txtrptunit2, //合并后报告ID
                      sampledatetime2: this.sampledatetime2, //合并后报告日期
                      sampleno2: this.sampleno2, //合并后标本号
                  },
              })
              .then((res) => {
                  if (res.errcode == "1") {
                      this.SourceData = [];
                      this.PurposeData = [];
                      for (let i = 0; i < res.Data1.length; i++) {
                          var row = {};
                          row.rechkflag1 = res.Data1[i].rechkflag;
                          row.sampleno1 = res.Data1[i].sampleno;
                          row.barcode1 = res.Data1[i].barcode;
                          row.pat_name1 = res.Data1[i].pat_name;
                          row.pat_sexname1 = res.Data1[i].pat_sexname;
                          if (i < res.Data2.length) {
                              row.rechkflag2 = res.Data2[i].rechkflag;
                              row.sampleno2 = res.Data2[i].sampleno;
                              row.barcode2 = res.Data2[i].barcode;
                              row.pat_name2 = res.Data2[i].pat_name;
                              row.pat_sexname2 = res.Data2[i].pat_sexname;
                          }
                          this.SourceData.push(row);
                      }
                  }
              });
      },
      handlerrptitemchange(val) {
          this.getinitList(val);
      },
      patzlChange(e) {
          if (e) {
              this.reqxx = true;
              this.chkry = true;
              this.patzl = true;
              this.specimenlx = true;
          } else {
              this.reqxx = false;
              this.chkry = false;
              this.patzl = false;
              this.specimenlx = false;
          }
      },
      chkryChange(e) {
          if (e) {
              this.chkry = true;
              this.patzl = true;
          } else {
              this.chkry = false;
          }
      },
      reqxxChange(e) {
          if (e) {
              this.reqxx = true;
              this.patzl = true;
          } else {
              this.reqxx = false;
          }
      },
      allxmChange(e) {
          if (e) {
              this.allxm = true;
              this.chartxx = true;
              this.skipmerge = false;
              this.sanglexm = false;
              this.groupxm = false;
          } else {
              this.allxm = false;
              this.chartxx = false;
              this.skipmerge = false;
              this.sanglexm = false;
              this.groupxm = false;
          }
      },
      chartxxChange(e) {
          if (e) {
              this.chartxx = true;
          } else {
              this.chartxx = false;
          }
      },
      specimenlxChange(e) {
          if (e) {
              this.specimenlx = true;
              this.patzl = true;
          } else {
              this.specimenlx = false;
          }
      },
      sanglexmChange(e) {
          if (e) {
              this.singleitemshow = true;
              this.skipmerge = true;
              this.groupitemshow = false;
              this.groupxm = false;
              this.allxm = false;
              this.chartxx = false;
          } else {
              this.singleitemshow = false;
              this.skipmerge = false;
          }
      },
      groupxmChange(e) {
          if (e) {
              this.groupitemshow = true;
              this.skipmerge = true;
              this.singleitemshow = false;
              this.sanglexm = false;
              this.allxm = false;
              this.chartxx = false;
          } else {
              this.groupitemshow = false;
              this.skipmerge = false;
          }
      },
      skipmergeChange(e) {
          if (e) {
              this.skipmerge = true;
          } else {
              this.skipmerge = false;
          }
      },
      SingleChange() {
          this.singleitemmulti = "";
      },
      ListClassName({ row, rowIndex, column }) {
          if (column.property && column.property == "spacesplit") {
              return "backsplit";
          }
          if (row.rechkflag1 == "9" && column.property && column.property.indexOf("1") > -1) {
              return "RechkBack";
          }
          if (row.rechkflag2 == "9" && column.property && column.property.indexOf("2") > -1) {
              return "RechkBack";
          }
      },
      SelectRptItems(rows) {
          var revalname = "";
          var reval = "";
          if (rows.length > 0) {
              reval = rows[0].rpt_itemcode;
              revalname = rows[0].rpt_itemname;
              for (let i = 1; i < rows.length; i++) {
                  reval += "," + rows[i].rpt_itemcode;
                  revalname += "," + rows[i].rpt_itemname;
              }
          }

          this.singleItem = revalname;
          this.singleitemmulti = reval;
          this.dialogRptVisible = false;
      },
      sampleno2input(){
          let val1=0;
          if(this.sampleno1.indexOf("-")>-1){
             let start1=this.sampleno1.split("-")[0];
             let end1=this.sampleno1.split("-")[1];
             val1=Number(end1)-Number(start1);
          if(!!start1&&!!end1){
          let pos=this.sampleno2.indexOf("-");
          let start2=this.sampleno2.split("-")[0];
          let end2=this.sampleno2.split("-")[1];
         
          if(end2==""&&pos>-1){
              end2=Number(start2)+val1;
              this.sampleno2=start2+"-"+end2;
              setTimeout(() => {
                  this.HightlightPos(end2+"",pos+1);
              }, 10);
          }
          }
         
          }
         
      },
       HightlightPos(myValue,startPos) {
          var myField = document.getElementById("mergeaftersamplenoid");
          if (!!myField) {
              if (myField.selectionStart || myField.selectionStart === 0) {
                  var endPos = startPos + myValue.length;
                  this.$nextTick(() => {
                      myField.selectionStart = startPos;
                      myField.selectionEnd = startPos + myValue.length;
                  });
                  myField.focus();
                  myField.setSelectionRange(myField,startPos , endPos);
              }
          }
      },
  },
};
</script>

<style scoped>
.pagetop {
  width: 100%;
  height: 260px;
  display: -webkit-box;
  -webkit-box-pack: left;
  -webkit-box-align: center;
  position: absolute;
  z-index: 99;
}

.pagecenter {
  position: absolute;
  top: 265px;
  width: 100%;
  left: 0;
  bottom: 0px;
  overflow: auto;
}

.middle-center {
  position: absolute;
  height: 100%;
  left: 0px;
  right: 0px;
  border: 1px solid #ccc;
  overflow: auto;
  border-top: none;
}

.table1style tr td {
  padding: 0px 2px 0px 5px;
}
::v-deep .RechkBack {
  background-color: #c0ffc0;
}
::v-deep .backsplit {
  background-color: #e6e6e6;
}
::v-deep .datelist .el-input--suffix .el-input__inner {
  padding-right: 5px;
}
</style>